import { RouteObject } from '@/routes/interface';

export const seachRoute = (path: string, routes: RouteObject[]): RouteObject => {
  let resule: RouteObject = {};
  for (let item of routes) {
    if (item.path === path) return item;
    if (item.children) {
      const res = seachRoute(path, item.children);
      if (Object.keys(res).length) return res;
    }
  }
  return resule;
};
